home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
BORL_TIP
/
TI1000
/
TI1774.ASC
< prev
next >
Wrap
Text File
|
1994-02-15
|
4KB
|
199 lines
PRODUCT : Borland Pascal NUMBER : 1774
VERSION : 7.0
OS : WIN
DATE : February 15, 1994 PAGE : 1/3
TITLE : CREATING AN OWL APP WITH NO BORDER AND NO CAPTION
Sometimes programmers of OWL applications want to open a
main window that has no border, no caption, and which
fills the entire screen. The following example shows
how to do this.
To get started, override the Init Constructor. Then set
the Windows style to WS_VISIBLE and WS_POPUP:
Attr.Style := ws_Visible or ws_PopUp;
After doing this, the program will appear with no
border and no caption. However, the window will not
be visible unless you define its size. To give the
program a shape, assign it a width and height:
Attr.X := 100;
Attr.Y := 100;
Attr.H := 200;
Attr.W := 200;
Of course, if you want to show the window in a maximized
state, then you can simply send it a WM_SYSCOMMAND message
from the programs SETUPWINDOW procedure:
procedure TStepWindow.SetUpWindow;
begin
inherited SetUpWindow;
PostMessage(HWindow, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
end;
To sum up, the shortest way from point A to point B is to
first give the window the WS_POPUP style, and then
maximize it with the WM_SYSCOMMAND message. If you
want to create a window that is not maximized, then be
sure to set the window's width and height. The example
below shows a maximized window:
program NoCaption;
uses WinTypes, WinProcs, OWindows, Strings;
type
PRODUCT : Borland Pascal NUMBER : 1774
VERSION : 7.0
OS : WIN
DATE : February 15, 1994 PAGE : 2/3
TITLE : CREATING AN OWL APP WITH NO BORDER AND NO CAPTION
PStepWindow = ^TStepWIndow;
TStepWindow = object(TWindow)
constructor Init(P: PWindowsObject; AName: PChar);
procedure SetUpWindow; virtual;
procedure Paint(PaintDC: HDC; var PaintInfo: TPaintStruct);
virtual;
procedure WMLButtonDown(var Msg: TMessage);
virtual wm_First + wm_LButtonDown;
end;
TMyApplication = object(TApplication)
procedure InitMainWindow; virtual;
end;
constructor TStepWindow.Init(P: PWindowsObject; AName: PChar);
begin
inherited Init(P, Aname);
Attr.Style := ws_Visible or WS_PopUp;
{ Attr.H := 200;
Attr.W := 200; }
end;
procedure TStepWindow.SetUpWindow;
begin
inherited SetUpWindow;
PostMessage(HWindow, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
end;
procedure TStepWindow.WMLButtonDown(var Msg: TMessage);
begin
CloseWindow;
end;
procedure TStepWindow.Paint(PaintDC: HDC;
var PaintInfo: TPaintStruct);
var
S: array[0..100] of Char;
begin
StrCopy(S, 'Click on Window to close it');
TextOut(PaintDC, 10, 10, S, StrLen(S));
end;
procedure TMyApplication.InitMainWindow;
PRODUCT : Borland Pascal NUMBER : 1774
VERSION : 7.0
OS : WIN
DATE : February 15, 1994 PAGE : 3/3
TITLE : CREATING AN OWL APP WITH NO BORDER AND NO CAPTION
begin
MainWindow := New(PStepWindow, Init(nil, 'Steps'));
end;
var
MyApp: TMyApplication;
begin
MyApp.Init('Steps');
MyApp.Run;
MyApp.Done;
end.
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.